package com.leijie.nio;

import java.nio.IntBuffer;
import java.security.SecureRandom;

/**
 * @author LeiJie
 * @time 2020-5-8 15:23
 * @desc Nio 小试牛刀
 */
public class NioTest1 {

    public static void main(String[] args) {
        IntBuffer intBuffer = IntBuffer.allocate(10);

        for (int i=0;i<intBuffer.capacity();i++){
            intBuffer.put(new SecureRandom().nextInt(20));
        }

        intBuffer.flip();

        while (intBuffer.hasRemaining()){
            System.out.println(intBuffer.get());
        }
    }

}
